<!DOCTYPE html>
<html lang="en">

	<include file="Public:header" />	      	
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Common/Ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Common/Ueditor/ueditor.all.min.js"></script>
	<script language="javascript" type="text/javascript" src="__ROOT__/Statics/My97/WdatePicker.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
	<include file="Public:page_css" />

	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<include file="Public:nav" />
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content no-padding">
						<ul class="list-group">
							<li class="list-group-item">
								<p class="text-success"><a href="{:U('Index/index')}" title="返回首页" class="tip-bottom">
									<i class="fa fa-home"></i> 首页</a> /
									<a href="#" class="tip-bottom">本地生活</a> /
									<a href="{:U('life/index')}" class="tip-bottom">信息管理</a> /
									<a href="#" class="tip-bottom">编辑信息</a>
								</p>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>编辑信息</h5>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal" method="post" action="{:U('Life/edit',array('life_id'=>$detail['life_id']))}" name="basic_validate" id="signupForm">
							<div class="form-group">
								<label class="col-sm-2 control-label">标题</label>
								<div class="col-sm-6">
									<input type="text" name="title" id="title" value="{$detail.title|default=''}" placeholder="输入广告标题" class="form-control">
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">子标题</label>
								<div class="col-sm-6">
									<input type="text" name="subtitle" id="subtitle" value="{$detail.subtitle|default=''}" placeholder="输入广告子标题" class="form-control">
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
				                <label class="col-sm-2 control-label">所属分类</label>
				                <div class="col-sm-6">                   				                    
                                    <select id="cate_id" name="cate_id" class="form-control m-b chosen-select">
			                            <foreach name="list" item="var">
			                                <eq name="var.pid" value="0">
			                                <option value="{$var.cate_id}"  <eq name="var.cate_id" value="$detail.cate_id">selected="selected"</eq> >{$var.cate_name}</option>                
			                                <foreach name="list" item="var2">
			                                    <eq name="var2.pid" value="$var.cate_id">
			                                    <option value="{$var2.cate_id}"  <eq name="var2.cate_id" value="$detail.cate_id">selected="selected"</eq> > &nbsp;&nbsp;&nbsp;|---{$var2.cate_name}</option>
			                                    </eq>
			                                </foreach>
			                                </eq>
			                            </foreach>
			                    	</select>                                    
				                </div>
				            </div>				            
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">图片 </label>
								<div class="col-sm-6">
									<div style="width: 200px; height: 110px; float: left;">
										<input type="hidden" name="photo" value="{$detail.photo|default=''}" id="data_photo" />
										<input id="photo_file" name="photo_file" type="file" multiple="true" value="" />
									</div>
									<div style="width: 200px; height: 110px; float: left;">
										<img id="upload_img" src="__ROOT__/Uploads/{$detail.photo|default='default.jpg'}" style="width: 150px;height: 100px" />
									</div>
								</div>
							</div>							
							<div class="hr-line-dashed"></div>
							<div class="form-group">
                                <label class="col-sm-2 control-label">内容</label>
                                <div class="col-sm-10">
                                    <script type="text/plain" id="editor" name="content" style="width:78%;height:300px;">{$detail.content|htmlspecialchars_decode|stripslashes}</script>
                                </div>
                            </div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">手机号码</label>
								<div class="col-sm-6">
									<input type="text" name="mobile" id="mobile" value="{$detail.mobile|default=''}" placeholder="输入手机号码" class="form-control">
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">地址</label>
								<div class="col-sm-6">
									<input type="text" name="addr" id="addr" value="{$detail.addr|default=''}" placeholder="输入地址" class="form-control">
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">是否审核</label>
								<div class="col-sm-6">
									<div class="radio i-checks">
	                        			<if condition="$detail['audit'] eq 1 ">
											<input type="radio" name='audit' value="1" checked="checked" />已审核
											<input type="radio" name='audit' value="0" />未审核
										</if>
										<if condition="$detail['audit'] eq 0 ">
											<input type="radio" name='audit' value="1" />已审核
											<input type="radio" name='audit' value="0" checked="checked" />未审核
										</if>
	                        		</div>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">是否推荐</label>
								<div class="col-sm-6">
									<div class="radio i-checks">
										<if condition="$detail['is_red'] eq 1 ">
											<input type="radio" name='is_red' value="1" checked="checked" />是
											<input type="radio" name='is_red' value="0" />否
										</if>
										<if condition="$detail['is_red'] eq 0 ">
											<input type="radio" name='is_red' value="1" />是
											<input type="radio" name='is_red' value="0" checked="checked" />否
										</if>
	                        		</div>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">访问量</label>
								<div class="col-sm-6">
									<input type="text" name="views" id="views" value="{$detail.views|default=''}" placeholder="输入访问量" class="form-control">
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-2">
									<button class="btn btn-primary" type="submit">保存内容</button>
									<a class="btn btn-danger" href="{:U('life/index')}">取消</a>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<include file="Public:footer" />
		
	<js file='__PUBLIC__/Common/js/uploadify/jquery.uploadify.min.js' />
			
	<link rel="stylesheet" href="__PUBLIC__/Common/js/uploadify/uploadify.css"> 
		
	<!--前端表单验证必须引入的3个js-->   
	<script src="__PUBLIC__/Admin/js/plugins/validate/jquery.validate.min.js"></script>
	<script src="__PUBLIC__/Admin/js/plugins/validate/messages_zh.min.js"></script>
	<script src="__PUBLIC__/Admin/js/form-validate-adduser.js"></script>
  
	<script type="text/javascript">
		$("#photo_file").uploadify({
			'swf': '__PUBLIC__/Common/js/uploadify/uploadify.swf?t={$nowtime}',
			'uploader': '{:U("Upload/upload")}',
			'cancelImg': '__PUBLIC__/Common/js/uploadify/uploadify-cancel.png',
			'buttonText': '上传图片',
			'fileTypeExts': '*.gif;*.jpg;*.png',
			'queueSizeLimit': 1,
			'onUploadSuccess': function(file, data, response) {
				$("#data_photo").val(data);
				$("#upload_img").attr('src', '__ROOT__/Uploads' + data).show();
			}
		});
			
		var ue = UE.getEditor('editor');
		 // 自定义的编辑器配置项,此处定义的配置项将覆盖editor_config.js中的同名配置
		var editor_a = new baidu.editor.ui.Editor(editorOption);
		editor_a.render('editor');
		
	</script>
	<script>
       
        var config = {
            '.chosen-select': {},                    
        }
        for (var selector in config) {
            $(selector).chosen(config[selector]);
        }

    </script>
	</body>
</html>
